'use strict';

const moment = require('moment')
const { parse } = require('./profileParser.js')

const db = uniCloud.database();

exports.main = async ({id}) => {	
	const collection = db.collection('profiles')
	let {data: profile} = await collection.where({id}).get()
	profile[0] = await parse(profile[0] )
	return {
		date: moment().format('YYYY-MM-DD'),
		status: 'success',
		data: profile
	}
};
